home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / computerjanitor / plugins / deb_plugin.py < prev    next >
Encoding:
Python Source  |  2009-04-27  |  1.3 KB  |  44 lines

  1. # deb_plugin.py - common package for post_cleanup for apt/.deb packages
  2. # Copyright (C) 2008  Canonical, Ltd.
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, version 3 of the License.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program.  If not, see <http://www.gnu.org/licenses/>.
  15.  
  16.  
  17. import os
  18.  
  19. import computerjanitor
  20. import apt
  21.  
  22.  
  23. class DebPlugin(computerjanitor.Plugin):
  24.  
  25.     """Plugin for post_cleanup processing with apt.
  26.     
  27.     This plugin does not find any cruft of its own. Instead it
  28.     centralizes the post_cleanup handling for all packages that remove
  29.     .deb packages.
  30.     
  31.     """
  32.  
  33.     def get_cruft(self):
  34.         return []
  35.  
  36.     def post_cleanup(self):
  37.         try:
  38.             self.app.apt_cache.commit(apt.progress.TextFetchProgress(),
  39.                                       apt.progress.DumbInstallProgress())
  40.         except Exception, e: # pragma: no cover
  41.             raise
  42.         finally:
  43.             self.app.refresh_apt_cache()
  44.